First Beta
First working beta copy
This commit is contained in:
parent
d9e4b6d159
commit
d673ff86ef
9 changed files with 391 additions and 0 deletions
2
kpad/.directory
Normal file
2
kpad/.directory
Normal file
|
@ -0,0 +1,2 @@
|
|||
[Desktop Entry]
|
||||
Icon=./.icon.png
|
17
kpad/.gitignore
vendored
Normal file
17
kpad/.gitignore
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
#---- Gambas files to ignore (v5)
|
||||
*.gambas
|
||||
.lock
|
||||
*~
|
||||
core
|
||||
core.*
|
||||
vgcore
|
||||
vgcore.*
|
||||
.kdbg*
|
||||
.*.prof
|
||||
.lang/*.pot
|
||||
.gambas/*
|
||||
.settings
|
||||
.startup
|
||||
.list
|
||||
.info
|
||||
#----
|
BIN
kpad/.icon.png
Normal file
BIN
kpad/.icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
20
kpad/.project
Normal file
20
kpad/.project
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Gambas Project File 3.0
|
||||
Title=Kpad
|
||||
Startup=FMain
|
||||
Version=0.0.4
|
||||
Component=gb.image
|
||||
Component=gb.gui.qt
|
||||
Component=gb.form
|
||||
Component=gb.eval
|
||||
Component=gb.eval.highlight
|
||||
Component=gb.form.dialog
|
||||
Component=gb.util
|
||||
Component=gb.form.editor
|
||||
Component=gb.settings
|
||||
Component=gb.term
|
||||
Component=gb.pcre
|
||||
Component=gb.signal
|
||||
TabSize=2
|
||||
Language=en_US
|
||||
KeepDebugInfo=0
|
||||
Packager=1
|
193
kpad/.src/FMain.class
Normal file
193
kpad/.src/FMain.class
Normal file
|
@ -0,0 +1,193 @@
|
|||
' Gambas class file
|
||||
|
||||
' Notes
|
||||
' Plugins are going to be tricky proably to port over
|
||||
' On the up shot I won't have to check the OS first
|
||||
' There are many features I want to add from the Texteditor class that aren't well documented so I'll have to look at the gambas source itself
|
||||
|
||||
Public regx As New RegExp
|
||||
Private txtc As Boolean ' Contents of text editor used in combination with tchng to see if a change worthy of saving is made
|
||||
|
||||
|
||||
Public Sub Menu5_Click()
|
||||
|
||||
CloseDoc()
|
||||
Me.Close
|
||||
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu2_Click()
|
||||
|
||||
regx.Compile("^(#!)/(.*)/(.*)") ' gambas doesn't seem to want #! and / escaped as would be the norm for pcre
|
||||
' Works for things like #!/bin/bash or #!/usr/bin/perl
|
||||
'perl -ne 'print "$1 $2 $3" if /^(#!)\/(.*)\/(.*)/' install_lastpass.sh
|
||||
'#! bin bash
|
||||
|
||||
Dialog.OpenFile() ' Dialog behaves a little like $_ when looking for its value
|
||||
If Dialog.Path Then
|
||||
TextEditor1.Load(Dialog.Path) ' Love this componet, has all the features, but not well documented
|
||||
Else
|
||||
|
||||
Endif
|
||||
' Some code to examine if this runable script by checking for the shebang line #!/usr/bin/perl for example
|
||||
' I think we can use PCRE here, check first line for #! using capture groups
|
||||
|
||||
regx.Exec(TextEditor1.Text)
|
||||
If regx.Count > 1 Then
|
||||
Menu24.Caption = "With " & regx[3].Text
|
||||
Menu24.Enabled = True
|
||||
Else
|
||||
Endif
|
||||
FMain.Title = "Kpad " & Dialog.Path
|
||||
txtc = TextEditor1.Text
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu3_Click()
|
||||
|
||||
If Dialog.Path Then
|
||||
TextEditor1.Save(Dialog.Path)
|
||||
Else
|
||||
Dialog.SaveFile()
|
||||
TextEditor1.Save(Dialog.Path)
|
||||
Endif
|
||||
txtc = False
|
||||
|
||||
|
||||
End
|
||||
|
||||
'Public Sub FMain_Open() != Form_Open()
|
||||
|
||||
' much like the original perl plugin load / initialize goes here
|
||||
' we will stick with the .kpd extension for them
|
||||
' This whille be added later once we figure out how eval works and if its doable in the same way
|
||||
|
||||
Private Function CloseDoc() As Boolean
|
||||
|
||||
If txtc Then
|
||||
Select Case Message.Question(("\n\nFile has been modified. Do you want to save it ?"), ("Yes"), ("No"), ("Cancel"))
|
||||
Case 1
|
||||
Dialog.SaveFile()
|
||||
TextEditor1.Save(Dialog.Path)
|
||||
Case 3
|
||||
Return True
|
||||
End Select
|
||||
Endif
|
||||
|
||||
txtc = False
|
||||
|
||||
|
||||
End
|
||||
|
||||
Private Sub SetModify(modded As Boolean)
|
||||
|
||||
If txtc = modded Then Return
|
||||
txtc = modded
|
||||
|
||||
|
||||
End
|
||||
|
||||
|
||||
' The following might be good to hook for detecting changes in the editor so we can make sure to save
|
||||
|
||||
Public Sub TextEditor1_Change()
|
||||
|
||||
SetModify(True)
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu4_Click()
|
||||
|
||||
If Menu4.Checked Then
|
||||
TextEditor1.Wrap = True
|
||||
Else
|
||||
TextEditor1.Wrap = False
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu10_Click()
|
||||
|
||||
TextEditor1.HighlightString(Null, True, True)
|
||||
Global.fndin = Null
|
||||
Find.Show
|
||||
Global.waitfor() ' wait for find form to be done
|
||||
TextEditor1.HighlightString(Global.fndin, True, True) ' Seems like a good idea to highlight
|
||||
Global.cbflag = 0
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu12_Click()
|
||||
|
||||
If Menu12.Checked Then
|
||||
TextEditor1.ShowLineNumber = True
|
||||
Else
|
||||
TextEditor1.ShowLineNumber = False
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu13_Click()
|
||||
|
||||
If Menu13.Checked Then
|
||||
TextEditor1.ShowPosition = True
|
||||
Else
|
||||
TextEditor1.ShowPosition = False
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu14_Click()
|
||||
|
||||
TextEditor1.Cut()
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu15_Click()
|
||||
|
||||
TextEditor1.Copy()
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu16_Click()
|
||||
|
||||
TextEditor1.Paste()
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu9_Click()
|
||||
|
||||
Message.Info("Kpad v6 beta ported to gambas \n Parts may fall off", "Ok")
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu22_Click()
|
||||
|
||||
TextEditor1.SelectAll()
|
||||
|
||||
End
|
||||
|
||||
Public Sub Menu24_Click()
|
||||
|
||||
' This does work but gambas app launched from a console, looks like gb.term.form might be option in the future
|
||||
Exec [regx[3].Text, Dialog.Path] ' We might want to pop that into a visible window for shell stuff, does work
|
||||
'Shell(regx[3].Text & " " & Dialog.Path)
|
||||
End
|
||||
|
||||
Public Sub Menu25_Click()
|
||||
|
||||
TextEditor1.Clear()
|
||||
FMain.Title = "Kpad New File"
|
||||
|
||||
End
|
||||
|
||||
Public Sub Form_Close()
|
||||
|
||||
If CloseDoc() Then Stop Event
|
||||
|
||||
End
|
||||
|
||||
Public Sub Form_Open()
|
||||
txtc = False
|
||||
End
|
102
kpad/.src/FMain.form
Normal file
102
kpad/.src/FMain.form
Normal file
|
@ -0,0 +1,102 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,65,63)
|
||||
Expand = True
|
||||
Text = ("Kpad")
|
||||
Arrangement = Arrange.Fill
|
||||
AutoResize = True
|
||||
{ Menu1 Menu
|
||||
Text = ("File")
|
||||
{ Menu25 Menu
|
||||
Text = ("New")
|
||||
}
|
||||
{ Menu2 Menu
|
||||
Text = ("Open")
|
||||
}
|
||||
{ Menu3 Menu
|
||||
Text = ("Save / Save As")
|
||||
Shortcut = "Ctrl+S"
|
||||
}
|
||||
{ Menu5 Menu
|
||||
Text = ("Exit")
|
||||
Shortcut = "Ctrl+X"
|
||||
}
|
||||
}
|
||||
{ Menu6 Menu
|
||||
Text = ("Edit")
|
||||
{ Menu10 Menu
|
||||
Text = ("Find")
|
||||
}
|
||||
{ Menu11 Menu
|
||||
Text = ("Replace")
|
||||
Enabled = False
|
||||
}
|
||||
{ Menu19 Menu
|
||||
Text = ("--------")
|
||||
}
|
||||
{ Menu14 Menu
|
||||
Text = ("Cut")
|
||||
}
|
||||
{ Menu15 Menu
|
||||
Text = ("Copy")
|
||||
}
|
||||
{ Menu16 Menu
|
||||
Text = ("Paste")
|
||||
}
|
||||
{ Menu22 Menu
|
||||
Text = ("Select All")
|
||||
}
|
||||
{ Menu20 Menu
|
||||
Text = ("--------")
|
||||
}
|
||||
{ Menu17 Menu
|
||||
Text = ("Redo")
|
||||
}
|
||||
{ Menu18 Menu
|
||||
Text = ("Undo")
|
||||
}
|
||||
}
|
||||
{ Menu7 Menu
|
||||
Text = ("View")
|
||||
{ Menu4 Menu
|
||||
Text = ("Word Wrap")
|
||||
Toggle = True
|
||||
}
|
||||
{ Menu13 Menu
|
||||
Text = ("Cursor Position")
|
||||
Toggle = True
|
||||
}
|
||||
{ Menu12 Menu
|
||||
Text = ("Line Numbers")
|
||||
Toggle = True
|
||||
}
|
||||
}
|
||||
{ Menu23 Menu
|
||||
Text = ("Run")
|
||||
{ Menu24 Menu
|
||||
Text = ("Run with")
|
||||
Enabled = False
|
||||
}
|
||||
}
|
||||
{ Menu21 Menu
|
||||
Text = ("Plugins")
|
||||
Enabled = False
|
||||
}
|
||||
{ Menu8 Menu
|
||||
Text = ("Help")
|
||||
{ Menu9 Menu
|
||||
Text = ("About")
|
||||
}
|
||||
}
|
||||
{ Panel1 Panel
|
||||
MoveScaled(0,0.1429,64,59)
|
||||
Expand = True
|
||||
Arrangement = Arrange.Fill
|
||||
AutoResize = True
|
||||
{ TextEditor1 TextEditor
|
||||
MoveScaled(0,0,64,59)
|
||||
Expand = True
|
||||
}
|
||||
}
|
||||
}
|
11
kpad/.src/Find.class
Normal file
11
kpad/.src/Find.class
Normal file
|
@ -0,0 +1,11 @@
|
|||
' Gambas class file
|
||||
|
||||
|
||||
Public Sub Button1_Click()
|
||||
|
||||
Global.fndin = TextBox1.Text
|
||||
Global.cbflag = 1
|
||||
TextBox1.Clear
|
||||
Find.Hide
|
||||
|
||||
End
|
18
kpad/.src/Find.form
Normal file
18
kpad/.src/Find.form
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Gambas Form File 3.0
|
||||
|
||||
{ Form Form
|
||||
MoveScaled(0,0,64,16)
|
||||
Text = ("Find")
|
||||
Resizable = False
|
||||
{ Label1 Label
|
||||
MoveScaled(1,5,10,4)
|
||||
Text = ("Find What:")
|
||||
}
|
||||
{ Button1 Button
|
||||
MoveScaled(47,10,16,5)
|
||||
Text = ("Find")
|
||||
}
|
||||
{ TextBox1 TextBox
|
||||
MoveScaled(11,5,26,4)
|
||||
}
|
||||
}
|
28
kpad/.src/Global.class
Normal file
28
kpad/.src/Global.class
Normal file
|
@ -0,0 +1,28 @@
|
|||
' Gambas class file
|
||||
|
||||
' This is annoying about gambas, but I'll have to deal with it
|
||||
' A work around for lack of a real project wide global
|
||||
|
||||
Export
|
||||
Create Static
|
||||
|
||||
' This will contain some public code used to "FIX" some sillyness in Gambas
|
||||
|
||||
' Variables first some might get removed
|
||||
|
||||
Public cbflag As Integer
|
||||
Public txtch As Integer
|
||||
Public dlgtitle As String
|
||||
Public fndin As String
|
||||
Public rpstr As String
|
||||
|
||||
|
||||
' Allows for waiting on custom dialogs, shouldn't have had to do it like this
|
||||
|
||||
Public Sub waitfor()
|
||||
|
||||
Repeat
|
||||
Wait 0.2 ' Low delay as we don't want to chew up all the cycles
|
||||
Until Global.cbflag = 1
|
||||
|
||||
End
|
Loading…
Add table
Add a link
Reference in a new issue