OSDN Git Service

Save column widths of log window
[winbottle/winbottle.git] / bottleclient / LogForm.pas
index 1103227..92a882c 100755 (executable)
@@ -202,6 +202,7 @@ begin
 end;
 
 procedure TfrmLog.FormCreate(Sender: TObject);
+var i: integer;
 begin
   FBottleLogList := TObjectList.Create;
   FBottleLogList.Add(TBottleLogList.Create('\83J\83\8c\83\93\83g')); // CurrentBottleLog
@@ -217,11 +218,27 @@ begin
   end;
   lvwLog.DoubleBuffered := true;
   edtScript.Height := Pref.LogWindowDividerPos;
+
+  i := 0;
+  while Token(Pref.LogWindowColumnWidth, ',', i) <> '' do begin
+    lvwLog.Columns[i].Width := StrToIntDef(Token(Pref.LogWindowColumnWidth, ',', i), 100);
+    Inc(i);
+  end;
+
   UpdateWindow; // Reset window color and enabled status of some buttons
 end;
 
 procedure TfrmLog.FormDestroy(Sender: TObject);
+var i: integer;
+    WidthStr: String;
 begin
+  WidthStr := '';
+  for i := 0 to lvwLog.Columns.Count-1 do begin
+    if i > 0 then WidthStr := WidthStr + ',';
+    WidthStr := WidthStr + IntToStr(lvwLog.Column[i].Width);
+  end;
+  Pref.LogWindowColumnWidth := WidthStr;
+
   with Pref.LogWindowPosition do begin
     Left   := Self.Left;
     Top    := Self.Top;