File: togglegrid.lua

package info (click to toggle)
xournalpp 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 30,036 kB
  • sloc: cpp: 64,137; xml: 939; sh: 752; ansic: 362; python: 338; php: 74; makefile: 15
file content (18 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

-- Register all Toolbar actions and initialize all UI stuff
function initUi()
  app.registerUi({["menu"] = "Toggle Grid Paper", ["callback"] = "toggleGridPaper"});
end

local toggleState = false

function toggleGridPaper()
  if toggleState == true then
    app.changeActionState("grid-snapping", true);
    app.changeCurrentPageBackground("graph");
  else
    app.changeActionState("grid-snapping", false);
    app.changeCurrentPageBackground("plain");
  end
  toggleState = not toggleState
end