summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2010-02-17 18:53:10 +0100
committerTomas Bzatek <tbzatek@redhat.com>2010-02-17 18:53:10 +0100
commit2ef485ec4f51c9fe7fb9fa99511db3960812cfd0 (patch)
tree802ff1ce8c1cfbb7f42a3c46873c6f0b948b0835
parentd338f1f0c1a72665396d95bfe303ed408a3f10b9 (diff)
downloadtuxcmd-2ef485ec4f51c9fe7fb9fa99511db3960812cfd0.tar.xz
Move viewer windows to separate window groups
Each viewer window now belongs to its own window group so they can't influence each other. Works nicely when opened from Search dialog too. Finally, no need to make separate viewer app.
-rw-r--r--UMain.pas10
-rw-r--r--USearch.pas2
-rw-r--r--UViewer.pas4
3 files changed, 10 insertions, 6 deletions
diff --git a/UMain.pas b/UMain.pas
index 56198fc..26d0781 100644
--- a/UMain.pas
+++ b/UMain.pas
@@ -250,7 +250,7 @@ type
LeftPanelEngine, RightPanelEngine : TPanelEngine;
ColumnSortIDs: array[1..ConstNumPanelColumns] of integer;
LastClick: TDateTime;
- procedure EditViewFileInternal(ParentWindow: TGTKControl; Filename: string; Engine: TPanelEngine; View, NewFile: boolean);
+ procedure EditViewFileInternal(Filename: string; Engine: TPanelEngine; View, NewFile: boolean);
end;
var
@@ -3459,8 +3459,8 @@ begin
ANewDir.Free;
end;
end else AFile := IncludeTrailingPathDelimiter(Engine.Path) + PDataItem(AListView.Selected.Data)^.FName;
-
- EditViewFileInternal(Self, AFile, Engine, View, NewFile);
+
+ EditViewFileInternal(AFile, Engine, View, NewFile);
finally
Application.ProcessMessages;
@@ -3468,7 +3468,7 @@ begin
end;
end;
-procedure TFMain.EditViewFileInternal(ParentWindow: TGTKControl; Filename: string; Engine: TPanelEngine; View, NewFile: boolean);
+procedure TFMain.EditViewFileInternal(Filename: string; Engine: TPanelEngine; View, NewFile: boolean);
var s: string;
Stat: PDataItem;
Error, x: integer;
@@ -3495,7 +3495,7 @@ begin
Application.MessageBox(Format('Cannot load file ''%s''. Please check the permissions.', [ANSIToUTF8(AFile)]), [mbOK], mbError);
AViewer.Free;
end else AViewer.Resume; *)
- AViewer := TFViewer.Create(ParentWindow);
+ AViewer := TFViewer.Create(Self);
if not AViewer.LoadFile(Filename) then begin
Application.MessageBox(Format(LANGCannotLoadFile, [Filename]), [mbOK], mbError, mbNone, mbOK);
AViewer.Free;
diff --git a/USearch.pas b/USearch.pas
index 732bcdb..3ae35f9 100644
--- a/USearch.pas
+++ b/USearch.pas
@@ -601,7 +601,7 @@ begin
AEngine := TLocalTreeEngine.Create;
b := True;
end;
- if b then FMain.EditViewFileInternal(Self, string(PDataItem(FileList.Selected.AsPointer(0))^.FDisplayName), AEngine, True, False)
+ if b then FMain.EditViewFileInternal(string(PDataItem(FileList.Selected.AsPointer(0))^.FDisplayName), AEngine, True, False)
else Application.MessageBox(Format(LANGCannotLoadFile, [string(PDataItem(FileList.Selected.AsPointer(0))^.FDisplayName)]), [mbOK], mbError, mbNone, mbOK);
if AEngine is TVFSEngine then
(AEngine as TVFSEngine).VFSClose(nil);
diff --git a/UViewer.pas b/UViewer.pas
index a80a434..6e5fe85 100644
--- a/UViewer.pas
+++ b/UViewer.pas
@@ -42,6 +42,7 @@ type
private
// LineHeight, NumLines: integer;
LineBuffer: TStringList;
+ window_group: PGtkWindowGroup;
procedure ApplyFont;
protected
AThread: TThread;
@@ -76,6 +77,8 @@ function scroll_event_callback(widget: PGtkWidget; event: PGdkEventScroll; user_
procedure TFViewer.FormCreate(Sender: TObject);
begin
+ window_group := gtk_window_group_new();
+ gtk_window_group_add_window(window_group, PGtkWindow(FWidget));
SetDefaultSize(700, 500);
Caption := 'TuxView';
BorderWidth := 5;
@@ -140,6 +143,7 @@ procedure TFViewer.FormDestroy(Sender: TObject);
begin
try
LineBuffer.Free;
+ g_object_unref(window_group);
except end;
end;