maxide patch [Gtk]

BlitzMax Forums/BlitzMax Module Tweaks/maxide patch [Gtk]

markcw(Posted 2014) [#1]
Note: You can download my patched builds of 1.43 and 2.01CE using Webkit and Scintilla here http://www.blitzmax.com/logs/userlog.php?user=8652&log=1737

This is for the default MaxIDE available from the product updates page (MaxIDE_v140b_src.zip).

The patch sets Gtkmaxgui as the framework. For my own reference I use this to make patches
diff -u maxide-copy.bmx maxide.bmx > maxide.patch


31-3-2014 - Fixed open file requester not loading initial path. For some reason this works in Fltk but not in Gtk, so I made sure it works by supplying RequestFile with an initial path (I believe Gtk shows the correct behavior in this case).
16-4-2014 - Updated open file requester not loading initial path fix. Now it will open the directory that the current selected panel is in. Previously it was just the last used path.

To apply the patch in Linux rename the file to maxide140.bmx, cd to the directory and run this (or just copy & paste the code yourself)
patch maxide140.bmx < maxide140.patch


maxide140.patch
--- maxide140-copy.bmx	2014-04-02 18:22:45.050609093 +0100
+++ maxide140.bmx	2014-04-16 21:23:32.015542970 +0100
@@ -247,7 +247,8 @@
 
 Strict
 
-Framework MaxGUI.Drivers
+'Framework MaxGUI.Drivers
+Framework bah.gtkmaxgui
 Import MaxGUI.ProxyGadgets
 
 ?Win32
@@ -257,6 +258,7 @@
 'Import bah.gtkmaxgui
 'Import bah.gtkwebgtkhtml
 'Import bah.gtkwebmozilla
+Import bah.gtkwebkitgtk
 
 Import brl.eventqueue
 Import brl.standardio
@@ -5813,7 +5815,7 @@
 		Local	code:TOpenCode
 		Local	ext$,p$
 		If path$="."
-			path$=RequestFile(LocalizeString("{{request_openfile}}"),FileTypeFilters )
+			path$=RequestFile(LocalizeString("{{request_openfile}}"),FileTypeFilters,False,currentpanel.path )
 			If path$="" Return
 		EndIf
 ' check if already open



markcw(Posted 2014) [#2]
I've now realized there is a newer version of the default MaxIDE v1.43 by skidracer here so I tried it out and it also had the Gtk open file requester not setting initial path bug.

19-4-2014 - Fixed tab size set to a ridiculously high amount, at least in Gtk. It was tabsize(4)*charwidth(8)=32. I just set charwidth=1 and now it's normal (ie. tabsize 4=8 chars).
- Fixed open file requester not setting inital path.

patch maxide143.bmx < maxide143.patch


maxide143.patch
--- maxide143-copy.bmx	2014-04-02 16:11:55.200888865 +0100
+++ maxide143.bmx	2014-04-19 23:43:58.137252000 +0100
@@ -10,7 +10,8 @@
 
 Strict
 
-Framework MaxGUI.Drivers
+'Framework MaxGUI.Drivers
+Framework bah.gtkmaxgui
 Import MaxGUI.ProxyGadgets
 
 ?Win32
@@ -20,6 +21,7 @@
 'Import bah.gtkmaxgui
 'Import bah.gtkwebgtkhtml
 'Import bah.gtkwebmozilla
+Import bah.gtkwebkitgtk
 
 Import brl.eventqueue
 Import brl.standardio
@@ -4165,7 +4167,7 @@
 		Local	rgb:TColor
 		Local	src$
 		Local charwidth				
-		charwidth=host.options.editfont.CharWidth(32)
+		charwidth=1 'host.options.editfont.CharWidth(32)
 		SetTextAreaTabs textarea,host.options.tabsize*charwidth		
 		SetMargins textarea,4		
 		SetTextAreaFont textarea,host.options.editfont
@@ -5572,7 +5574,7 @@
 		Local	code:TOpenCode
 		Local	ext$,p$
 		If path$="."
-			path$=RequestFile(LocalizeString("{{request_openfile}}"),FileTypeFilters )
+			path$=RequestFile(LocalizeString("{{request_openfile}}"),FileTypeFilters,False,currentpanel.path )
 			If path$="" Return
 		EndIf
 ' check if already open


Edit: I just discovered that the tab size set to ridiculously high amount bug is only present in the default maxgui textarea gadget and when you use the scintilla gadget it works fine. So here is a patch that uses the scintilla gadget without that fix.

maxide143.bmx [scintilla]
--- maxide143-copy.bmx	2014-04-02 16:11:55.200888865 +0100
+++ maxide143.bmx	2014-04-30 22:06:36.143680555 +0100
@@ -10,7 +10,9 @@
 
 Strict
 
-Framework MaxGUI.Drivers
+'Framework MaxGUI.Drivers
+Framework bah.gtkmaxgui
+Import bah.maxguitextareascintilla
 Import MaxGUI.ProxyGadgets
 
 ?Win32
@@ -20,6 +22,7 @@
 'Import bah.gtkmaxgui
 'Import bah.gtkwebgtkhtml
 'Import bah.gtkwebmozilla
+Import bah.gtkwebkitgtk
 
 Import brl.eventqueue
 Import brl.standardio
@@ -5572,7 +5575,7 @@
 		Local	code:TOpenCode
 		Local	ext$,p$
 		If path$="."
-			path$=RequestFile(LocalizeString("{{request_openfile}}"),FileTypeFilters )
+			path$=RequestFile(LocalizeString("{{request_openfile}}"),FileTypeFilters,False,currentpanel.path )
 			If path$="" Return
 		EndIf
 ' check if already open



markcw(Posted 2014) [#3]
This is the same Gtk fix as above for the CE MaxIDE v2.01 found here http://blitzmax-ide.sourceforge.net/

19-4-2014 - Fixed open file requester not loading initial path. Now opens the directory of the current selected panel.

See gui_module.bmx for setting Gtkmaxgui as the framework.

patch bmxhost.bmx < bmxhost.patch


bmxhost.patch
--- bmxhost-copy.bmx	2014-04-19 02:26:00.730604511 +0100
+++ bmxhost.bmx	2014-04-19 02:24:58.674296788 +0100
@@ -446,7 +446,12 @@
 		ElseIf path = "." Then
 ' handler for open
 DebugLog FILTER_Files
-			files = RequestMultiFile( "@@main_window/open_title", FILTER_Files )
+			Local initpath$ 'init open file path [gtk]
+			For panel=EachIn panels
+				If panel=activepanel Then initpath=panel.path ; Exit
+			Next
+			If currentpanel.index=0 Then initpath=bmxpath+"/bin"
+			files = RequestMultiFile( "@@main_window/open_title", FILTER_Files, initpath )
 			If files.Length <= 0 Then Return Null
 			' prepend path to all filenames
 			If files.Length > 1 Then