OSDN Git Service

タスクトレイの右クリックで終了メニューを出すようにした。
[gikonavigoeson/gikonavi.git] / GikoSystem.pas
index 572526f..3a7fcac 100644 (file)
@@ -256,6 +256,9 @@ type
         procedure AddOutofIndexDat(Board: TBoard; DatList: TStringList; AllCreate: boolean = True);
         //! \83t\83@\83C\83\8b\96¼\82©\82ç\82Ì\83X\83\8c\83b\83h\8dì\90¬\93ú\82Ì\8eæ\93¾
         function GetCreateDateFromName(FileName: String): TDateTime;
+        function GetExtpreviewFileName: String;
+
+        procedure ShowRefCount(msg: String; unk: IUnknown);
        end;
 
 var
@@ -265,7 +268,7 @@ const
        ZERO_DATE: Integer      = 25569;
        BETA_VERSION_NAME_E = 'beta';
        BETA_VERSION_NAME_J = 'ÊÞÀ';
-       BETA_VERSION                            = 57;
+       BETA_VERSION                            = 58;
        BETA_VERSION_BUILD      = '';                           //!< debug\94Å\82È\82Ç
        APP_NAME                                                = 'gikoNavi';
        BE_PHP_URL = 'http://be.2ch.net/test/p.php?i=';
@@ -284,6 +287,7 @@ const
        NGWORDs_DIR_NAME : String               = 'NGwords';
 
        READ_PATH: string =                     '/test/read.cgi/';
+    HTML_READ_PATH: string =        '/test/read.html/';
        OLD_READ_PATH: string =         '/test/read.cgi?';
        KAKO_PATH: string =                     '/kako/';
 
@@ -306,6 +310,7 @@ const
 // *************************************************************************
 constructor TGikoSys.Create;
 begin
+    Inherited;
        FSetting := TSetting.Create;
        FDolib := TDolib.Create;
        FAWKStr := TAWKStr.Create(nil);
@@ -344,18 +349,6 @@ var
        i: Integer;
        FileList: TStringList;
 begin
-       //\83X\83\8c\83b\83h\83f\81[\83^\83t\83@\83C\83\8b\82ð\8dX\90V
-//     FlashExitWrite;
-
-//     FExitWrite.Free;
-       FBayesian.Free;
-       FAWKStr.Free;
-       FSetting.Free;
-       FDolib.Free;
-       FAbon.Free;
-       FSelectResFilter.Free;
-    FGikoMessage.Free;
-       //FBoardURLList.Free;
        //\83e\83\93\83|\83\89\83\8aHTML\82ð\8dí\8f\9c
        FileList := TStringList.Create;
        try
@@ -368,6 +361,13 @@ begin
        finally
                FileList.Free;
        end;
+    FreeAndNil(FGikoMessage);
+       FreeAndNil(FBayesian);
+       FreeAndNil(FSelectResFilter);
+       FreeAndNil(FAbon);
+       FreeAndNil(FAWKStr);
+       FreeAndNil(FDolib);
+       FreeAndNil(FSetting);
        inherited;
 end;
 
@@ -1190,10 +1190,10 @@ end;
 }
 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
 var
-       Code: Integer;
+       Code: Cardinal;
 begin
        Code := GetFileAttributes(PChar(Name));
-       Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
+       Result := (Code <> Cardinal(-1)) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
 end;
 
 {!
@@ -1348,17 +1348,15 @@ var
        nm: NONCLIENTMETRICS;
 begin
        nm.cbSize := sizeof(NONCLIENTMETRICS);
-
-       SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
-       lf := nm.lfMenuFont;
-
-       Font.Name := lf.lfFaceName;
-       Font.Height := lf.lfHeight;
-       Font.Style := [];
-       if lf.lfWeight >= 700 then
-               Font.Style := Font.Style + [fsBold];
-       if lf.lfItalic = 1 then
-               Font.Style := Font.Style + [fsItalic];
+    SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
+    lf := nm.lfMenuFont;
+    Font.Name := lf.lfFaceName;
+    Font.Height := lf.lfHeight;
+    Font.Style := [];
+    if lf.lfWeight >= 700 then
+        Font.Style := Font.Style + [fsBold];
+    if lf.lfItalic = 1 then
+        Font.Style := Font.Style + [fsItalic];
 end;
 
 {!
@@ -1841,7 +1839,13 @@ begin
        Index := AnsiPos(READ_PATH, path);
        if Index <> 0 then begin
                s := Copy(path, Index + Length(READ_PATH), Length(path));
-
+    end else begin
+        Index := AnsiPos(HTML_READ_PATH, path);
+        if Index <> 0 then begin
+            s := Copy(path, Index + Length(HTML_READ_PATH), Length(path));
+        end;
+    end;
+    if Index <> 0 then begin
                if (Length(s) > 0) and (s[1] = '/') then
                        Delete(s, 1, 1);
                BBSID := GetTokenIndex(s, '/', 0);
@@ -2070,7 +2074,7 @@ begin
                //\95W\8f\80\8f\91\8e®
                //\8dÅ\8cã\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n- \82È\82Ç
                //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
-               FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
+               FAWKStr.RegExp := '/test/read.(cgi|html)/.+/[0-9]+/?.*';
                if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
                        s := Copy(s, 15, Length(s));
 
@@ -3453,6 +3457,12 @@ function TGikoSys.GetReplaceFileName: String;
 begin
     Result := Setting.GetReplaceFileName;
 end;
+//! \83v\83\8c\83r\83\85\81[\8ag\92£\82Ì\90Ý\92è\83t\83@\83C\83\8b\8eæ\93¾
+function TGikoSys.GetExtpreviewFileName: String;
+begin
+    Result := Setting.GetExtprevieFileName;
+end;
+
 //! \83t\83@\83C\83\8b\96¼\82©\82ç\82Ì\83X\83\8c\83b\83h\8dì\90¬\93ú\82Ì\8eæ\93¾
 function TGikoSys.GetCreateDateFromName(FileName: String): TDateTime;
 var
@@ -3474,12 +3484,30 @@ begin
     Result := UnixToDateTime(unixtime) + OffsetFromUTC;
 end;
 
+procedure TGikoSys.ShowRefCount(msg: String; unk: IUnknown);
+var
+    count : integer;
+begin
+    if not Assigned(unk) then
+        Exit;
+
+{$IFDEF DEBUG}
+    try
+        unk._AddRef;
+        count := unk._Release;
+
+               Writeln(msg + ' RefCount=' + IntToStr(count));
+    except
+               Writeln(msg + ' RefCount=exception!!');
+       end;
+{$ENDIF}
+end;
+
 initialization
        GikoSys := TGikoSys.Create;
 
 finalization
        if GikoSys <> nil then begin
-               GikoSys.Free;
-               GikoSys := nil;
+               FreeAndNil(GikoSys);
        end;
 end.