70 |
slot |
slot |
71 |
end |
end |
72 |
|
|
73 |
|
# A command to reload all previously loaded files |
74 |
|
# delete from the list all those files that cannot be loaded |
75 |
|
cmd_mgr.add("EditPane/RestoreFiles", "Restore Files from previous session") do |cmd_slot| |
76 |
|
plugin['properties/files'].each_slot do |slot| |
77 |
|
ep_slot = cmd_mgr.command('App/File/Load').invoke(slot.data) |
78 |
|
slot.prune if ep_slot.nil? |
79 |
|
end |
80 |
|
end |
81 |
|
|
82 |
ComponentManager.new(plugin, base_slot, EditPane) |
ComponentManager.new(plugin, base_slot, EditPane) |
83 |
plugin.transition(FreeBASE::RUNNING) |
plugin.transition(FreeBASE::RUNNING) |
106 |
def load_file(filename) |
def load_file(filename) |
107 |
@base_slot.data = filename |
@base_slot.data = filename |
108 |
@actions['load_file'].invoke(filename, breakpoints) |
@actions['load_file'].invoke(filename, breakpoints) |
109 |
|
|
110 |
|
# check if the file is already in the properties and if so |
111 |
|
# delete it and recreate it with the same slot number as the |
112 |
|
# editpane itself. (Easier for deletion) |
113 |
|
@plugin['properties/files'].each_slot do |prop_slot| |
114 |
|
prop_slot.prune if prop_slot.data == filename |
115 |
|
end |
116 |
|
@plugin["properties/files/#{@base_slot.name}"].data = filename |
117 |
@plugin.log_debug << "File #{@base_slot.data} loaded in slot #{@base_slot.path}" |
@plugin.log_debug << "File #{@base_slot.data} loaded in slot #{@base_slot.path}" |
118 |
end |
end |
119 |
|
|
120 |
## |
## |
121 |
# make the editpane current (generally makes it visible on top - see Renderer) |
# make the editpane current (generally makes it visible on top - see Renderer) |
132 |
# 'yes' means the file was saved (if needed) and closed |
# 'yes' means the file was saved (if needed) and closed |
133 |
# 'no' means the file was closed and not saved (even if needed) |
# 'no' means the file was closed and not saved (even if needed) |
134 |
# 'cancel' means the close operation was aborted |
# 'cancel' means the close operation was aborted |
135 |
|
# The close_all flag is here to indicate whether this method is called |
136 |
|
# when FR is exiting, in which case we don't want to save property files |
137 |
|
# because the list of files to restore is empty !! |
138 |
# |
# |
139 |
def close |
def close(close_all=false) |
140 |
if self.modified? |
if self.modified? |
141 |
answer = @cmd_mgr.command("App/Services/YesNoCancelDialog").invoke("Save Changes...", "Save changes to '#{@base_slot.data}'?") |
answer = @cmd_mgr.command("App/Services/YesNoCancelDialog").invoke("Save Changes...", "Save changes to '#{@base_slot.data}'?") |
142 |
answer = self.save if answer == 'yes' |
answer = self.save if answer == 'yes' |
153 |
slot.manager.make_current |
slot.manager.make_current |
154 |
end |
end |
155 |
|
|
156 |
# at that point we can close and delete the slot |
# at that point we can close and delete the editpane slot |
157 |
|
# and the property slot |
158 |
@actions['close'].invoke |
@actions['close'].invoke |
159 |
@base_slot.prune |
@base_slot.prune |
160 |
|
@plugin["properties/files/#{@base_slot.name}"].prune unless close_all |
161 |
|
@plugin.properties.save |
162 |
return answer |
return answer |
163 |
end |
end |
164 |
|
|