Skip to content

Commit

Permalink
Merge pull request #4 from fenix-hub/v0.3.2
Browse files Browse the repository at this point in the history
V0.3.1
  • Loading branch information
fenix-hub authored Sep 24, 2019
2 parents a4a2ca2 + 4718c21 commit 1277e54
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 38 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
!You can delete this file, you'll find it in the *file-editor* folder!

# Godot Text Editor
A little plugin to easy-way manage your text files inside your project folder.

Author: *"Nicolo (fenix) Santilio"*
Version: *0.2.5*
Version: *0.3.1*
Godot Version: *3.1.1-stable*

**This repository was pushed directly from Godot Engine Editor thanks to [GitHub Integration](https://github.com/fenix-hub/godot-engine.github-integration)!**
Expand Down
7 changes: 4 additions & 3 deletions addons/file-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
A little plugin to easy-way manage your text files inside your project folder.

Author: *"Nicolo (fenix) Santilio"*
Version: *0.2.5*
Version: *0.3.1*
Godot Version: *3.1.1-stable*

**This repository was pushed directly from Godot Engine Editor thanks to [GitHub Integration](https://github.com/fenix-hub/godot-engine.github-integration)!**
Expand All @@ -28,11 +28,12 @@ Then, go to `Project > Plugins > "File Editor" > Status > Activate`.
You can find this plugin in the AssetLib of Godot Engine Editor. Just download it from there and everything should be fine!
(Remember to activate this plugin)

#### Current version
### Current version
To check all the features included in the current version, please read the [VERSION file](./VERSION.md)

#### Upcoming features
### Upcoming features
To check all the features I'm currently working on, please read the [TODO file](./TODO.md)

# Want to contact me?
I'm planning to create a Discord group to collect each plugin I've made (and I will make), but until then you can directly talk with my via e-mail at *[email protected]*

2 changes: 2 additions & 0 deletions addons/file-editor/TODO.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
### to do (v-0.x.x)
- Popup dialog when closing a tab if there is new content
- Module for markdown support/conversion

12 changes: 10 additions & 2 deletions addons/file-editor/VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
**version 0.2.5**
*removed*
- Old layout

-----------------------

*added*
- New Layout
Expand All @@ -33,3 +31,13 @@

-----------------------

**version 0.3.1**
*added*
- Version check
- Preview support
- Context menu in editor
- BBCode converter
- Light Mardkwon converter (DEMO)

-----------------------

Binary file added addons/file-editor/fonts/COUR.TTF
Binary file not shown.
Binary file added addons/file-editor/fonts/Carlito-Bold.ttf
Binary file not shown.
Binary file added addons/file-editor/fonts/Carlito-BoldItalic.ttf
Binary file not shown.
Binary file added addons/file-editor/fonts/Carlito-Italic.ttf
Binary file not shown.
Binary file added addons/file-editor/fonts/Carlito-Regular.ttf
Binary file not shown.
4 changes: 2 additions & 2 deletions addons/file-editor/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

name="File Editor"
description="An internal file editor to view and edit text files in your project folder."
author="Nicolò 'fenix' Santi"
version="0.2.5"
author="Nicolò 'fenix' Santilio"
version="0.3.1"
script="scripts/file-editor.gd"
35 changes: 24 additions & 11 deletions addons/file-editor/scenes/FileEditor.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=10 format=2]

[ext_resource path="res://addons/file-editor/scripts/FileEditor.gd" type="Script" id=1]
[ext_resource path="res://addons/file-editor/icons/new.svg" type="Texture" id=2]
[ext_resource path="res://addons/file-editor/icons/file.svg" type="Texture" id=3]
[ext_resource path="res://addons/file-editor/icons/delete.svg" type="Texture" id=4]
[ext_resource path="res://addons/file-editor/fonts/Roboto-Black.ttf" type="DynamicFontData" id=5]

[sub_resource type="StyleBoxFlat" id=1]
[sub_resource type="DynamicFont" id=1]
size = 13
font_data = ExtResource( 5 )

[sub_resource type="StyleBoxFlat" id=2]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color( 0.196078, 0.231373, 0.309804, 1 )
Expand All @@ -25,7 +30,7 @@ border_width_right = 1
border_color = Color( 0.121569, 0.145098, 0.192157, 1 )
expand_margin_bottom = 1.0

[sub_resource type="StyleBoxFlat" id=2]
[sub_resource type="StyleBoxFlat" id=4]
bg_color = Color( 0.121569, 0.145098, 0.192157, 1 )
draw_center = false
border_width_left = 1
Expand All @@ -44,42 +49,50 @@ anchor_right = 1.0
anchor_bottom = 1.0

[node name="Buttons" type="HBoxContainer" parent="Container"]
editor/display_folded = true
margin_right = 1024.0
margin_bottom = 22.0

[node name="newfile_btn" type="Button" parent="Container/Buttons"]
margin_right = 338.0
margin_right = 337.0
margin_bottom = 22.0
size_flags_horizontal = 3
text = "Create new File"
icon = ExtResource( 2 )

[node name="openfile_btn" type="Button" parent="Container/Buttons"]
margin_left = 342.0
margin_right = 680.0
margin_left = 341.0
margin_right = 678.0
margin_bottom = 22.0
size_flags_horizontal = 3
text = "Open File"
icon = ExtResource( 3 )

[node name="deletefile_btn" type="Button" parent="Container/Buttons"]
margin_left = 684.0
margin_right = 1024.0
margin_left = 682.0
margin_right = 1019.0
margin_bottom = 22.0
size_flags_horizontal = 3
text = "Delete File"
icon = ExtResource( 4 )

[node name="version" type="Label" parent="Container/Buttons"]
margin_left = 1023.0
margin_top = 2.0
margin_right = 1023.0
margin_bottom = 19.0
custom_fonts/font = SubResource( 1 )
custom_colors/font_color = Color( 0.121569, 0.145098, 0.192157, 1 )
align = 1

[node name="Editor" type="TabContainer" parent="Container"]
visible = false
margin_top = 32.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_vertical = 3
custom_styles/tab_fg = SubResource( 1 )
custom_styles/tab_fg = SubResource( 2 )
custom_styles/tab_bg = SubResource( 3 )
custom_styles/panel = SubResource( 2 )
custom_styles/panel = SubResource( 4 )
custom_colors/font_color_fg = Color( 1, 1, 1, 1 )
tab_align = 0
drag_to_rearrange_enabled = true
Expand Down
32 changes: 16 additions & 16 deletions addons/file-editor/scenes/FileScene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
[ext_resource path="res://addons/file-editor/icons/edit.png" type="Texture" id=3]
[ext_resource path="res://addons/file-editor/fonts/Roboto-Black.ttf" type="DynamicFontData" id=4]

[sub_resource type="StyleBoxFlat" id=8]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 10.0
content_margin_right = 10.0
bg_color = Color( 0.145098, 0.172549, 0.231373, 1 )

[sub_resource type="StyleBoxEmpty" id=1]

[sub_resource type="StyleBoxEmpty" id=2]

[sub_resource type="StyleBoxEmpty" id=3]
Expand All @@ -22,7 +20,9 @@ bg_color = Color( 0.145098, 0.172549, 0.231373, 1 )

[sub_resource type="StyleBoxEmpty" id=6]

[sub_resource type="DynamicFont" id=7]
[sub_resource type="StyleBoxEmpty" id=7]

[sub_resource type="DynamicFont" id=8]
font_data = ExtResource( 4 )

[node name="filename" type="VBoxContainer"]
Expand All @@ -40,7 +40,6 @@ margin_right = 1016.0
margin_bottom = 4.0

[node name="TopBar" type="HBoxContainer" parent="."]
editor/display_folded = true
margin_top = 8.0
margin_right = 1016.0
margin_bottom = 28.0
Expand All @@ -53,11 +52,11 @@ margin_bottom = 20.0
margin_left = 8.0
margin_right = 51.0
margin_bottom = 20.0
custom_styles/hover = SubResource( 8 )
custom_styles/normal = SubResource( 8 )
custom_styles/hover = SubResource( 1 )
custom_styles/normal = SubResource( 1 )
text = "File"
flat = false
items = [ "Save File", null, 0, false, false, 0, 0, null, "", false, "Save file As...", null, 0, false, false, 1, 0, null, "", false ]
items = [ "Save File", null, 0, false, false, 0, 0, null, "", false, "Save file As...", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Normal Preview", null, 0, false, false, 2, 0, null, "", false, "BBCode Preview", null, 0, false, false, 3, 0, null, "", false, "Markdown Preview (DEMO)", null, 0, false, false, 4, 0, null, "", false ]

[node name="filepath" type="Label" parent="TopBar"]
margin_left = 519.0
Expand Down Expand Up @@ -90,7 +89,8 @@ highlight_all_occurrences = true
smooth_scrolling = true
wrap_enabled = true
caret_blink = true
caret_blink_speed = 0.1
caret_blink_speed = 1.0
caret_moving_by_right_click = false

[node name="FileInfo" type="HBoxContainer" parent="."]
editor/display_folded = true
Expand All @@ -117,13 +117,13 @@ margin_bottom = 19.0
size_flags_horizontal = 10
custom_icons/checked = ExtResource( 2 )
custom_icons/unchecked = ExtResource( 3 )
custom_styles/hover = SubResource( 1 )
custom_styles/pressed = SubResource( 2 )
custom_styles/focus = SubResource( 3 )
custom_styles/disabled = SubResource( 4 )
custom_styles/hover_pressed = SubResource( 5 )
custom_styles/normal = SubResource( 6 )
custom_fonts/font = SubResource( 7 )
custom_styles/hover = SubResource( 2 )
custom_styles/pressed = SubResource( 3 )
custom_styles/focus = SubResource( 4 )
custom_styles/disabled = SubResource( 5 )
custom_styles/hover_pressed = SubResource( 6 )
custom_styles/normal = SubResource( 7 )
custom_fonts/font = SubResource( 8 )
custom_colors/font_color = Color( 0.145098, 0.172549, 0.231373, 1 )
custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
text = "Can Edit"
Expand Down
53 changes: 53 additions & 0 deletions addons/file-editor/scenes/Preview.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[gd_scene load_steps=12 format=2]

[ext_resource path="res://addons/file-editor/scripts/Preview.gd" type="Script" id=1]
[ext_resource path="res://addons/file-editor/fonts/COUR.TTF" type="DynamicFontData" id=2]
[ext_resource path="res://addons/file-editor/fonts/Carlito-BoldItalic.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://addons/file-editor/fonts/Carlito-Italic.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://addons/file-editor/fonts/Carlito-Bold.ttf" type="DynamicFontData" id=5]
[ext_resource path="res://addons/file-editor/fonts/Carlito-Regular.ttf" type="DynamicFontData" id=6]

[sub_resource type="DynamicFont" id=5]
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )

[sub_resource type="DynamicFont" id=1]
font_data = ExtResource( 3 )

[sub_resource type="DynamicFont" id=2]
font_data = ExtResource( 4 )

[sub_resource type="DynamicFont" id=3]
font_data = ExtResource( 5 )

[sub_resource type="DynamicFont" id=4]
font_data = ExtResource( 6 )

[node name="Preview" type="WindowDialog"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 81.0
margin_top = 47.0
margin_right = -80.0
margin_bottom = -48.0
window_title = "File preview"
resizable = true
script = ExtResource( 1 )

[node name="Container" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0

[node name="TextPreview" type="RichTextLabel" parent="Container"]
margin_right = 863.0
margin_bottom = 505.0
size_flags_vertical = 3
custom_fonts/mono_font = SubResource( 5 )
custom_fonts/bold_italics_font = SubResource( 1 )
custom_fonts/italics_font = SubResource( 2 )
custom_fonts/bold_font = SubResource( 3 )
custom_fonts/normal_font = SubResource( 4 )
bbcode_enabled = true
scroll_following = true
[connection signal="popup_hide" from="." to="." method="_on_Preview_popup_hide"]
13 changes: 12 additions & 1 deletion addons/file-editor/scripts/FileEditor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ onready var DeleteFile = $Container/Buttons/deletefile_btn
onready var NewFileDialogue = $NewFileDialogue
onready var NewFileDialogue_name = $NewFileDialogue/VBoxContainer/new_filename

onready var Version = $Container/Buttons/version

var FileScene = load("res://addons/file-editor/scenes/FileScene.tscn")

var DIRECTORY : String = "res://"
Expand All @@ -31,7 +33,6 @@ var EXTENSIONS : PoolStringArray = [
var directories = []
var files = []


func _ready():
OpenFile.connect("pressed",self,"open_selected_file")
NewFile.connect("pressed",self,"open_newfiledialogue")
Expand All @@ -45,6 +46,16 @@ func _ready():
FileList.set_filters(EXTENSIONS)

Editor.hide()

var plugin_version = ""
var config = ConfigFile.new()
var err = config.load("res://addons/file-editor/plugin.cfg")
if err == OK:
plugin_version = config.get_value("plugin","version")
update_version("v"+plugin_version)

func update_version(v : String):
Version.set_text(v)

func open_file(path : String):
var current_file : File = File.new()
Expand Down
27 changes: 27 additions & 0 deletions addons/file-editor/scripts/FileScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ onready var FilePath = $TopBar/filepath
var current_path = ""
var current_filename = ""

var Preview = load("res://addons/file-editor/scenes/Preview.tscn")

func _ready():
FileButton.connect("id_pressed",self,"button_pressed")

Expand Down Expand Up @@ -55,6 +57,7 @@ func save_file(current_path : String):
current_content = ""
current_file.store_line(current_content)
current_file.close()

var last_modified = OS.get_datetime_from_unix_time(current_file.get_modified_time(current_path))
LastModified.set_text(str(last_modified.hour)+":"+str(last_modified.minute)+" "+str(last_modified.day)+"/"+str(last_modified.month)+"/"+str(last_modified.year))

Expand Down Expand Up @@ -84,6 +87,30 @@ func button_pressed(id : int):
save_file(current_path)
elif id == 1:
save_file_as()
elif id == 2:
open_preview()
elif id == 3:
bbcode_preview()
elif id == 4:
markdown_preview()

func open_preview():
var preview = Preview.instance()
get_parent().get_parent().get_parent().add_child(preview)
preview.popup()
preview.print_preview(TextEditor.get_text())

func bbcode_preview():
var preview = Preview.instance()
get_parent().get_parent().get_parent().add_child(preview)
preview.popup()
preview.print_bb(TextEditor.get_text())

func markdown_preview():
var preview = Preview.instance()
get_parent().get_parent().get_parent().add_child(preview)
preview.popup()
preview.print_markdown(TextEditor.get_text())

func close_editor():
queue_free()
Expand Down
Loading

0 comments on commit 1277e54

Please sign in to comment.