Skip to content

Commit

Permalink
move from click to edit to double click to edit
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Oct 15, 2023
1 parent 7444de2 commit b0442c1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Template for new versions:
- `hide-tutorials`: fix the embark tutorial prompt sometimes not being skipped

## Misc Improvements
- `gui/gm-editor`: change from click to edit to click to select, double-click to edit. this should help prevent accidental modifications to the data and make zooming to location and selecting ids for dereferencing easier

## Removed

Expand Down
16 changes: 9 additions & 7 deletions docs/gui/gm-editor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ gui/gm-editor
This editor allows you to inspect or modify almost anything in DF. Press
:kbd:`?` for in-game help.

If you just want to browse without fear of accidentally changing anything, hit
:kbd:`Ctrl`:kbd:`D` to toggle read-only mode.
Select a field and hit :kbd:`Enter` or double click to edit, or, for structured
fields, to inspect their contents. Right click or hit :kbd:`Esc` to go back to
the previous structure you were inspecting. Right clicking when viewing the
structure you started with will exit the tool. Hold down :kbd:`Shift` and right
click to exit, even if you are inspecting a substructure, no matter how deep.

Click on fields to edit them or, for structured fields, to inspect their
contents. Right click or hit :kbd:`Esc` to go back to the previous structure
you were inspecting. Right clicking when viewing the structure you started with
will exit the tool. Hold down :kbd:`Shift` and right click to exit, even if you
are inspecting a substructure.
If you just want to browse without fear of accidentally changing anything, hit
:kbd:`Ctrl`:kbd:`D` to toggle read-only mode. If you want `gui/gm-editor` to
automatically pick up changes to game data in realtime, hit :kbd:`Alt`:kbd:`A`
to switch to auto update mode.

Usage
-----
Expand Down
11 changes: 6 additions & 5 deletions gui/gm-editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ function GmEditorUi:init(args)

local helpPage=widgets.Panel{
subviews={widgets.Label{text=helptext,frame = {l=1,t=1,yalign=0}}}}
local mainList=widgets.List{view_id="list_main",choices={},frame = {l=1,t=3,yalign=0},on_submit=self:callback("editSelected"),
on_submit2=self:callback("editSelectedRaw"),
text_pen=COLOR_GREY, cursor_pen=COLOR_YELLOW}
local mainList=widgets.List{view_id="list_main",choices={},frame = {l=1,t=3,yalign=0},on_double_click=self:callback("editSelected"),
on_double_click2=self:callback("editSelectedRaw"), text_pen=COLOR_GREY, cursor_pen=COLOR_YELLOW}
local mainPage=widgets.Panel{
subviews={
mainList,
Expand Down Expand Up @@ -443,7 +442,7 @@ end
function GmEditorUi:editSelectedRaw(index,choice)
self:editSelected(index, choice, {raw=true})
end
function GmEditorUi:editSelected(index,choice,opts)
function GmEditorUi:editSelected(index,_,opts)
if not self:verifyStack() then
self:updateTarget()
return
Expand Down Expand Up @@ -530,7 +529,9 @@ function GmEditorUi:onInput(keys)
return false
end

if keys[keybindings.toggle_ro.key] then
if keys.SELECT then
self:editSelected(self.subviews.list_main:getSelected())
elseif keys[keybindings.toggle_ro.key] then
self.read_only = not self.read_only
self:updateTitles()
return true
Expand Down

0 comments on commit b0442c1

Please sign in to comment.