Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-26 Thread Stanislav Maslovski
On Sun, Aug 26, 2007 at 05:04:26PM +0400, Stanislav Maslovski wrote:
> On Sun, Aug 26, 2007 at 10:47:42PM +1000, Neil Hodgson wrote:
> > Stanislav Maslovski:
> > 
> > > Here goes the 3rd version of the patch (attached).
> > >   - focus behaviour corrected (finally?)
> > >   - LayoutUI() is now called after the properties have been read
> > >   - set minimum size hint to wContent
> > >
> > > Please check.
> > 
> >With this patch starting SciTE and opening a file doesn't show the
> > file: instead the output pane is maximized.
> 
> Sounds interesting :) I do not get such a behaviour here. Do you open the
> file the usual way from File->Open?
> 
> What is your GTK version? I will try to reproduce this.

No need. I got it. That is because of this change:
  - LayoutUI() is now called after the properties have been read 

Some resizing events got lost this way, I thought it would be harmless,
however. Sorry..

I will correct this.

-- 
Stanislav
___
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest


Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-26 Thread Stanislav Maslovski
On Sun, Aug 26, 2007 at 10:47:42PM +1000, Neil Hodgson wrote:
> Stanislav Maslovski:
> 
> > Here goes the 3rd version of the patch (attached).
> >   - focus behaviour corrected (finally?)
> >   - LayoutUI() is now called after the properties have been read
> >   - set minimum size hint to wContent
> >
> > Please check.
> 
>With this patch starting SciTE and opening a file doesn't show the
> file: instead the output pane is maximized.

Sounds interesting :) I do not get such a behaviour here. Do you open the
file the usual way from File->Open?

What is your GTK version? I will try to reproduce this.

-- 
Stanislav
___
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest


Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-26 Thread Neil Hodgson
Stanislav Maslovski:

> Here goes the 3rd version of the patch (attached).
>   - focus behaviour corrected (finally?)
>   - LayoutUI() is now called after the properties have been read
>   - set minimum size hint to wContent
>
> Please check.

   With this patch starting SciTE and opening a file doesn't show the
file: instead the output pane is maximized.

   Neil
___
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest


Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-23 Thread Stanislav Maslovski
Hello,

Here goes the 3rd version of the patch (attached).
  - focus behaviour corrected (finally?)
  - LayoutUI() is now called after the properties have been read
  - set minimum size hint to wContent

Please check.

-- 
Stanislav

On Tue, Aug 21, 2007 at 09:33:33AM +1000, Neil Hodgson wrote:
> Stanislav Maslovski:
> 
> >   - problem with cursors solved.
> 
>Using cursorInvalid in this way is good.
> 
> > >   - focus issues fixed.
> >
> > Oops, not all of them. When the output window is opened to
> > the maximum width the focus goes nowhere...
> 
>Its OK to be a bit heavy-handed, forcing the focus into a visible
> window even if it doesn't seem to be currently associated with an
> editing pane. That's better than any situation where typing goes
> nowhere.
> 
>   Neil
> ___
> Scite-interest mailing list
> Scite-interest@lyra.org
> http://mailman.lyra.org/mailman/listinfo/scite-interest

diff -urN scite-1.74-orig/scintilla/gtk/PlatGTK.cxx scite-1.74/scintilla/gtk/PlatGTK.cxx
--- scite-1.74-orig/scintilla/gtk/PlatGTK.cxx	2007-06-15 15:24:38.0 +0400
+++ scite-1.74/scintilla/gtk/PlatGTK.cxx	2007-08-23 11:53:24.847560293 +0400
@@ -1841,6 +1841,8 @@
 	cursorLast = curs;
 	GdkCursor *gdkCurs;
 	switch (curs) {
+	case cursorInvalid:
+		return;
 	case cursorText:
 		gdkCurs = gdk_cursor_new(GDK_XTERM);
 		break;
diff -urN scite-1.74-orig/scintilla/gtk/ScintillaGTK.cxx scite-1.74/scintilla/gtk/ScintillaGTK.cxx
--- scite-1.74-orig/scintilla/gtk/ScintillaGTK.cxx	2007-06-12 07:55:11.0 +0400
+++ scite-1.74/scintilla/gtk/ScintillaGTK.cxx	2007-08-23 11:53:24.847560721 +0400
@@ -568,6 +568,9 @@
 	gtk_widget_unmap(PWidget(wText));
 	gtk_widget_unmap(PWidget(scrollbarh));
 	gtk_widget_unmap(PWidget(scrollbarv));
+	wText.SetCursor(Window::cursorInvalid);
+	scrollbarv.SetCursor(Window::cursorInvalid);
+	scrollbarh.SetCursor(Window::cursorInvalid);
 }
 
 void ScintillaGTK::UnMap(GtkWidget *widget) {
diff -urN scite-1.74-orig/scite/gtk/SciTEGTK.cxx scite-1.74/scite/gtk/SciTEGTK.cxx
--- scite-1.74-orig/scite/gtk/SciTEGTK.cxx	2007-06-13 18:09:09.0 +0400
+++ scite-1.74/scite/gtk/SciTEGTK.cxx	2007-08-23 14:18:04.023497756 +0400
@@ -307,11 +307,9 @@
 
 protected:
 
-	Window wDivider;
+	GtkWidget *splitPane;
 	Point ptOld;
 	GdkGC *xor_gc;
-	bool focusEditor;
-	bool focusOutput;
 
 	guint sbContextID;
 	Window wToolBarBox;
@@ -497,11 +495,6 @@
 	static gint MousePress(GtkWidget *widget, GdkEventButton *event, SciTEGTK *scitew);
 	gint Mouse(GdkEventButton *event);
 
-	void DividerXOR(Point pt);
-	static gint DividerExpose(GtkWidget *widget, GdkEventExpose *ose, SciTEGTK *scitew);
-	static gint DividerMotion(GtkWidget *widget, GdkEventMotion *event, SciTEGTK *scitew);
-	static gint DividerPress(GtkWidget *widget, GdkEventButton *event, SciTEGTK *scitew);
-	static gint DividerRelease(GtkWidget *widget, GdkEventButton *event, SciTEGTK *scitew);
 	static void DragDataReceived(GtkWidget *widget, GdkDragContext *context,
 	 gint x, gint y, GtkSelectionData *selection_data, guint info, guint time, SciTEGTK *scitew);
 
@@ -538,6 +531,7 @@
 	  int startID = 0, const char *radioStart = 0);
 	void CreateMenu();
 	void CreateUI();
+	void LayoutUI();
 	void Run(int argc, char *argv[]);
 	void ProcessExecute();
 	virtual void Execute();
@@ -595,6 +589,8 @@
 	btnBuild = 0;
 	btnStop = 0;
 	itemFactory = 0;
+	splitPane = 0;
+	heightBar = 0;
 
 	fileSelectorWidth = 580;
 	fileSelectorHeight = 480;
@@ -835,6 +831,13 @@
 		SizeSubWindows();
 		CheckMenus();
 		break;
+	// override base class
+	case IDM_SPLITVERTICAL:
+		splitVertical = !splitVertical;
+		heightBar = 0;
+		LayoutUI();
+		CheckMenus();
+		break;
 
 	default:
 		SciTEBase::MenuCommand(cmdID, menuSource);
@@ -888,30 +891,50 @@
 }
 
 void SciTEGTK::SizeContentWindows() {
-	PRectangle rcClient = GetClientRectangle();
-#if GTK_MAJOR_VERSION < 2
-	int left = 0;
-	int top = 0;
-#else
-	int left = rcClient.left;
-	int top = rcClient.top;
-#endif
-	int w = rcClient.right - rcClient.left;
-	int h = rcClient.bottom - rcClient.top;
-	heightOutput = NormaliseSplit(heightOutput);
-	if (splitVertical) {
-		wEditor.SetPosition(PRectangle(left, top, w - heightOutput - heightBar + left, h + top));
-		wDivider.SetPosition(PRectangle(w - heightOutput - heightBar + left, top, w - heightOutput + left, h + top));
-		wOutput.SetPosition(PRectangle(w - heightOutput + left, top, w + left, h + top));
-	} else {
-		wEditor.SetPosition(PRectangle(left, top, w + left, h - heightOutput - heightBar + top));
-		wDivider.SetPosition(PRectangle(left, h - heightOutput - heightBar + top, w + left, h - heightOutput + top));
-		wOutput.SetPosition(PRectangle(left, h - heightOutput + top, w + left, h + top));
+	if (splitPane) {
+		// we come here when receiving resizing signals
+		int height, heightEditor, bar;
+		if (splitVertical) {
+			height = PWidget(wOutput)->allocation.width;
+			heightEditor =

Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-20 Thread Neil Hodgson
Stanislav Maslovski:

>   - problem with cursors solved.

   Using cursorInvalid in this way is good.

> >   - focus issues fixed.
>
> Oops, not all of them. When the output window is opened to
> the maximum width the focus goes nowhere...

   Its OK to be a bit heavy-handed, forcing the focus into a visible
window even if it doesn't seem to be currently associated with an
editing pane. That's better than any situation where typing goes
nowhere.

  Neil
___
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest


Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-20 Thread Stanislav Maslovski
On Mon, Aug 20, 2007 at 07:48:32PM +0400, Stanislav Maslovski wrote:
> Hello,
> 
> A new version of the patch is ready.
>   - focus issues fixed.

Oops, not all of them. When the output window is opened to
the maximum width the focus goes nowhere...

-- 
Stanislav
___
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest


Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-20 Thread Stanislav Maslovski
Hello,

A new version of the patch is ready.
  - focus issues fixed.
  - problem with cursors solved.

Please check.

-- 
Stanislav


On Sun, Aug 19, 2007 at 12:15:23PM +1000, Neil Hodgson wrote:
>Hi Stanislav,
> 
> >   - cursorLast and the related code was removed because it did not work
> > with dynamically destroyed/created windows. This removal should
> > not affect the win32 code.
> 
>There are several other platforms (OS/X, wxWidgets, QT, ...) so
> published APIs like this should not change. It would also be better to
> get this code working on GTK+ to avoid unnecessary calls to
> gdk_window_set_cursor. This may now be optimized but I think there was
> flickering on old versions of GTK+.
> 
>There are new focus issues when switching between horizontal and
> vertical layouts. The focus seems to go nowhere so typing has no
> effect.
diff -urN scite-1.74-orig/scintilla/gtk/PlatGTK.cxx scite-1.74/scintilla/gtk/PlatGTK.cxx
--- scite-1.74-orig/scintilla/gtk/PlatGTK.cxx	2007-06-15 15:24:38.0 +0400
+++ scite-1.74/scintilla/gtk/PlatGTK.cxx	2007-08-20 19:21:05.0 +0400
@@ -1841,6 +1841,8 @@
 	cursorLast = curs;
 	GdkCursor *gdkCurs;
 	switch (curs) {
+	case cursorInvalid:
+		return;
 	case cursorText:
 		gdkCurs = gdk_cursor_new(GDK_XTERM);
 		break;
diff -urN scite-1.74-orig/scintilla/gtk/ScintillaGTK.cxx scite-1.74/scintilla/gtk/ScintillaGTK.cxx
--- scite-1.74-orig/scintilla/gtk/ScintillaGTK.cxx	2007-06-12 07:55:11.0 +0400
+++ scite-1.74/scintilla/gtk/ScintillaGTK.cxx	2007-08-20 19:21:45.0 +0400
@@ -568,6 +568,9 @@
 	gtk_widget_unmap(PWidget(wText));
 	gtk_widget_unmap(PWidget(scrollbarh));
 	gtk_widget_unmap(PWidget(scrollbarv));
+	wText.SetCursor(Window::cursorInvalid);
+	scrollbarv.SetCursor(Window::cursorInvalid);
+	scrollbarh.SetCursor(Window::cursorInvalid);
 }
 
 void ScintillaGTK::UnMap(GtkWidget *widget) {
diff -urN scite-1.74-orig/scite/gtk/SciTEGTK.cxx scite-1.74/scite/gtk/SciTEGTK.cxx
--- scite-1.74-orig/scite/gtk/SciTEGTK.cxx	2007-06-13 18:09:09.0 +0400
+++ scite-1.74/scite/gtk/SciTEGTK.cxx	2007-08-20 17:55:32.0 +0400
@@ -307,11 +307,9 @@
 
 protected:
 
-	Window wDivider;
+	GtkWidget *splitPane;
 	Point ptOld;
 	GdkGC *xor_gc;
-	bool focusEditor;
-	bool focusOutput;
 
 	guint sbContextID;
 	Window wToolBarBox;
@@ -497,11 +495,6 @@
 	static gint MousePress(GtkWidget *widget, GdkEventButton *event, SciTEGTK *scitew);
 	gint Mouse(GdkEventButton *event);
 
-	void DividerXOR(Point pt);
-	static gint DividerExpose(GtkWidget *widget, GdkEventExpose *ose, SciTEGTK *scitew);
-	static gint DividerMotion(GtkWidget *widget, GdkEventMotion *event, SciTEGTK *scitew);
-	static gint DividerPress(GtkWidget *widget, GdkEventButton *event, SciTEGTK *scitew);
-	static gint DividerRelease(GtkWidget *widget, GdkEventButton *event, SciTEGTK *scitew);
 	static void DragDataReceived(GtkWidget *widget, GdkDragContext *context,
 	 gint x, gint y, GtkSelectionData *selection_data, guint info, guint time, SciTEGTK *scitew);
 
@@ -538,6 +531,7 @@
 	  int startID = 0, const char *radioStart = 0);
 	void CreateMenu();
 	void CreateUI();
+	void LayoutUI();
 	void Run(int argc, char *argv[]);
 	void ProcessExecute();
 	virtual void Execute();
@@ -595,6 +589,8 @@
 	btnBuild = 0;
 	btnStop = 0;
 	itemFactory = 0;
+	splitPane = 0;
+	heightBar = 0;
 
 	fileSelectorWidth = 580;
 	fileSelectorHeight = 480;
@@ -835,6 +831,13 @@
 		SizeSubWindows();
 		CheckMenus();
 		break;
+	// override base class
+	case IDM_SPLITVERTICAL:
+		splitVertical = !splitVertical;
+		heightBar = 0;
+		LayoutUI();
+		CheckMenus();
+		break;
 
 	default:
 		SciTEBase::MenuCommand(cmdID, menuSource);
@@ -888,30 +891,45 @@
 }
 
 void SciTEGTK::SizeContentWindows() {
-	PRectangle rcClient = GetClientRectangle();
-#if GTK_MAJOR_VERSION < 2
-	int left = 0;
-	int top = 0;
-#else
-	int left = rcClient.left;
-	int top = rcClient.top;
-#endif
-	int w = rcClient.right - rcClient.left;
-	int h = rcClient.bottom - rcClient.top;
-	heightOutput = NormaliseSplit(heightOutput);
+//	printf("SizeContentWindows: heightOutput = %d, prevHeightOutput = %d, heightBar = %d\n",
+//			heightOutput, previousHeightOutput, heightBar);
+	// we come here when receiving resizing signals
+	int height, bar;
 	if (splitVertical) {
-		wEditor.SetPosition(PRectangle(left, top, w - heightOutput - heightBar + left, h + top));
-		wDivider.SetPosition(PRectangle(w - heightOutput - heightBar + left, top, w - heightOutput + left, h + top));
-		wOutput.SetPosition(PRectangle(w - heightOutput + left, top, w + left, h + top));
+		height = PWidget(wOutput)->allocation.width;
+		bar = splitPane->allocation.width - PWidget(wEditor)->allocation.width - height;
 	} else {
-		wEditor.SetPosition(PRectangle(left, top, w + left, h - heightOutput - heightBar + top));
-		wDivider.SetPosition(PRectangle(left, h - heightOutput - heightBar + top, w + left, h - heightOutput + top));
-		wOutput.SetPositi

Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-18 Thread Stanislav Maslovski
On Sun, Aug 19, 2007 at 12:15:23PM +1000, Neil Hodgson wrote:
>Hi Stanislav,
> 
> >   - cursorLast and the related code was removed because it did not work
> > with dynamically destroyed/created windows. This removal should
> > not affect the win32 code.
> 
>There are several other platforms (OS/X, wxWidgets, QT, ...) so
> published APIs like this should not change.

Actually, this change should not be visible from the outside anyway,
because that cursorLast member is private and is not accessed directly.

But of course it is complitely possible to keep cursorLast in Platform.h.
It will not affect my code.

> It would also be better to
> get this code working on GTK+ to avoid unnecessary calls to
> gdk_window_set_cursor.

Yes, I would wish for the same. At the moment I do not understand
what happens with the cached cursors when wEditor and wOutput are removed
from their previous container and inserted into the new one. Maybe I could
tell these windows to reload cursors somehow? Can you give me a hint if this
is possible?

> This may now be optimized but I think there was
> flickering on old versions of GTK+.

I see.

> 
>There are new focus issues when switching between horizontal and
> vertical layouts. The focus seems to go nowhere so typing has no
> effect.

Oh, yes, I have not noticed. I will correct this.

-- 
Stanislav
___
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest


Re: [scite] [PATCH] SciTE 1.74 GTK+: layout based on native GtkPaned widget

2007-08-18 Thread Neil Hodgson
   Hi Stanislav,

>   - cursorLast and the related code was removed because it did not work
> with dynamically destroyed/created windows. This removal should
> not affect the win32 code.

   There are several other platforms (OS/X, wxWidgets, QT, ...) so
published APIs like this should not change. It would also be better to
get this code working on GTK+ to avoid unnecessary calls to
gdk_window_set_cursor. This may now be optimized but I think there was
flickering on old versions of GTK+.

   There are new focus issues when switching between horizontal and
vertical layouts. The focus seems to go nowhere so typing has no
effect.

   Neil
___
Scite-interest mailing list
Scite-interest@lyra.org
http://mailman.lyra.org/mailman/listinfo/scite-interest