Change Xournal program.

This commit is contained in:
igor
2026-04-17 01:15:14 -07:00
parent fd0595fb4a
commit 16c47afcd1
7 changed files with 2 additions and 316 deletions

14
xournalapp/palette.gpl Normal file
View File

@@ -0,0 +1,14 @@
GIMP Palette
Name: Xournal Default Palette
#
0 0 0 Black
0 128 0 Green
0 192 255 Light Blue
0 255 0 Light Green
51 51 204 Blue
128 128 128 Gray
255 0 0 Red
255 0 255 Magenta
255 128 0 Orange
255 255 0 Yellow
255 255 255 White

View File

@@ -0,0 +1,282 @@
-- Things I might want to add:
-- -ACTION_TOOL_DRAW_COORDINATE_SYSTEM (currently no way to turn it off!)
-- -ACTION_TOOL_DRAW_LINE currently doesn't exist!
-- Register all Toolbar actions and intialize all UI stuff
function initUi()
app.registerUi({["menu"] = "Pen", ["callback"] = "pen", ["accelerator"] = "b"});
app.registerUi({["menu"] = "Select Region", ["callback"] = "lasso", ["accelerator"] = "g"});
-- app.registerUi({["menu"] = "Blue Pen", ["callback"] = "blue_pen", ["accelerator"] = "f"});
-- app.registerUi({["menu"] = "Red Pen", ["callback"] = "red_pen", ["accelerator"] = "c"});
-- app.registerUi({["menu"] = "Green Pen", ["callback"] = "green_pen", ["accelerator"] = "s"});
-- app.registerUi({["menu"] = "Orange Pen", ["callback"] = "orange_pen", ["accelerator"] = "a"});
-- app.registerUi({["menu"] = "Cyan Pen", ["callback"] = "cyan_pen", ["accelerator"] = "z"});
-- app.registerUi({["menu"] = "Magenta Pen", ["callback"] = "magenta_pen", ["accelerator"] = "d"});
-- app.registerUi({["menu"] = "Lime Pen", ["callback"] = "lime_pen", ["accelerator"] = "x"});
-- app.registerUi({["menu"] = "Black Pen", ["callback"] = "black_pen", ["accelerator"] = "v"});
app.registerUi({["menu"] = "Highlighter", ["callback"] = "yellow_hl", ["accelerator"] = "f"});
-- app.registerUi({["menu"] = "Blue Highlighter", ["callback"] = "blue_hl", ["accelerator"] = "<Shift>f"});
-- app.registerUi({["menu"] = "Red Highlighter", ["callback"] = "red_hl", ["accelerator"] = "<Shift>d"});
-- app.registerUi({["menu"] = "Green Highlighter", ["callback"] = "green_hl", ["accelerator"] = "<Shift>s"});
-- app.registerUi({["menu"] = "Yellow Highlighter", ["callback"] = "yellow_hl", ["accelerator"] = "<Shift>a"});
app.registerUi({["menu"] = "Undo", ["callback"] = "undo", ["accelerator"] = "r"});
app.registerUi({["menu"] = "Redo", ["callback"] = "redo", ["accelerator"] = "<Shift>r"});
app.registerUi({["menu"] = "Copy", ["callback"] = "copy", ["accelerator"] = "<Control>Insert"});
app.registerUi({["menu"] = "Paste", ["callback"] = "paste", ["accelerator"] = "<Shift>Insert"});
app.registerUi({["menu"] = "Cut", ["callback"] = "cut", ["accelerator"] = "<Control>x"});
app.registerUi({["menu"] = "Delete", ["callback"] = "delete", ["accelerator"] = "BackSpace"});
app.registerUi({["menu"] = "Eraser", ["callback"] = "eraser", ["accelerator"] = "e"});
app.registerUi({["menu"] = "Select Object", ["callback"] = "select_object", ["accelerator"] = "<Shift>g"});
-- app.registerUi({["menu"] = "Draw Coordinates", ["callback"] = "draw_coords", ["accelerator"] = "q"});
app.registerUi({["menu"] = "Ruler", ["callback"] = "ruler", ["accelerator"] = "w"});
app.registerUi({["menu"] = "Ruler Arrow", ["callback"] = "ruler_arrow", ["accelerator"] = "<Shift>w"});
app.registerUi({["menu"] = "Ruler Double Arrow", ["callback"] = "ruler_arrow_double", ["accelerator"] = "<Alt>w"});
app.registerUi({["menu"] = "Style Plain", ["callback"] = "pen_plain", ["accelerator"] = "<Alt>1"});
app.registerUi({["menu"] = "Style Dash", ["callback"] = "pen_dash", ["accelerator"] = "<Alt>2"});
app.registerUi({["menu"] = "Style Dot", ["callback"] = "pen_dot", ["accelerator"] = "<Alt>3"});
app.registerUi({["menu"] = "Style Dash Dot", ["callback"] = "pen_dash_dot", ["accelerator"] = "<Alt>4"});
app.registerUi({["menu"] = "Size Fine", ["callback"] = "size_fine", ["accelerator"] = "<Shift>exclam"});
app.registerUi({["menu"] = "Size Medium", ["callback"] = "size_medium", ["accelerator"] = "<Shift>at"});
app.registerUi({["menu"] = "Size Thick", ["callback"] = "size_thick", ["accelerator"] = "<Shift>numbersign"});
app.registerUi({["menu"] = "Clear", ["callback"] = "delete", ["accelerator"] = "q"});
app.registerUi({["menu"] = "Clear", ["callback"] = "delete_all", ["accelerator"] = "<Shift>q"});
app.registerUi({["menu"] = "Hand", ["callback"] = "hand", ["accelerator"] = "v"});
end
-- "pen" or "highlighter";
-- local currentTool = "pen"
function hand()
app.uiAction({["action"] = "ACTION_TOOL_HAND"})
end
function pen()
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_LINE_STYLE_PLAIN"})
-- currentTool = "pen"
end
function pen_plain()
app.uiAction({["action"] = "ACTION_TOOL_LINE_STYLE_PLAIN"})
end
function pen_dash()
app.uiAction({["action"] = "ACTION_TOOL_LINE_STYLE_DASH"})
end
function pen_dash_dot()
app.uiAction({["action"] = "ACTION_TOOL_LINE_STYLE_DASH_DOT"})
end
function pen_dot()
app.uiAction({["action"] = "ACTION_TOOL_LINE_STYLE_DOT"})
end
--function highlighter()
-- app.uiAction({["action"] = "ACTION_TOOL_HIGHLIGHTER"})
-- app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
-- app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- currentTool = "highlighter"
--end
-- Notes: Changing selected strokes is not working. If there are no selected strokes,
-- or the current tool is not a pen/HL, then app.changeToolColor throws an error.
-- To make it work, we need some way of programatically testing if there is a selection.
function blue_pen()
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0x3333CC, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0x1313CC, ["tool"] = "pen"})
end
function blue_hl()
app.changeToolColor({["color"] = 0x20D0FF, ["tool"] = "highlighter"})
app.uiAction({["action"] = "ACTION_TOOL_HIGHLIGHTER"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
end
function green_pen()
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0x008000, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0x00A000, ["tool"] = "pen"})
end
function green_hl()
app.changeToolColor({["color"] = 0x00FF00, ["tool"] = "highlighter"})
app.uiAction({["action"] = "ACTION_TOOL_HIGHLIGHTER"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
end
function red_pen()
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0xEF0044, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0xEF0044, ["tool"] = "pen"})
end
function red_hl()
app.changeToolColor({["color"] = 0xFF55FF, ["tool"] = "highlighter"})
app.uiAction({["action"] = "ACTION_TOOL_HIGHLIGHTER"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
end
function orange_pen()
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0xEF7000, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0xEF7000, ["tool"] = "pen"})
end
function yellow_hl()
app.changeToolColor({["color"] = 0xEEFF00, ["tool"] = "highlighter"})
app.uiAction({["action"] = "ACTION_TOOL_HIGHLIGHTER"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
end
function cyan_pen()
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0x00BFE6, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0x00BFE6, ["tool"] = "pen"})
end
function magenta_pen()
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0xCC00CC, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0xCC00CC, ["tool"] = "pen"})
end
function lime_pen()
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0xBFE600, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0xBFE600, ["tool"] = "pen"})
end
function black_pen()
-- This changes the color of currently selected strokes
-- app.changeToolColor({["color"] = 0x000000, ["selection"] = true})
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM", ["enabled"] = false})
app.uiAction({["action"] = "ACTION_TOOL_RULER", ["enabled"] = false})
-- This changes the color of the pen
app.changeToolColor({["color"] = 0x000000, ["tool"] = "pen"})
end
function lasso()
app.uiAction({["action"] = "ACTION_TOOL_SELECT_REGION"})
end
function undo()
app.uiAction({["action"] = "ACTION_UNDO"})
end
function redo()
app.uiAction({["action"] = "ACTION_REDO"})
end
function copy()
app.uiAction({["action"] = "ACTION_COPY"})
end
function cut()
app.uiAction({["action"] = "ACTION_CUT"})
end
function paste()
app.uiAction({["action"] = "ACTION_PASTE"})
end
function delete()
app.uiAction({["action"] = "ACTION_DELETE"})
end
function delete_all()
select_all()
app.uiAction({["action"] = "ACTION_DELETE"})
end
function eraser()
app.uiAction({["action"] = "ACTION_TOOL_ERASER"})
end
function select_all()
app.uiAction({["action"] = "ACTION_SELECT_ALL"})
end
function select_object()
app.uiAction({["action"] = "ACTION_TOOL_SELECT_OBJECT"})
end
function ruler()
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_RULER"})
-- currentTool = "pen"
end
function ruler_arrow()
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_ARROW"})
-- currentTool = "pen"
end
function ruler_arrow_double()
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_DOUBLE_ARROW"})
-- currentTool = "pen"
end
function draw_coords()
app.uiAction({["action"] = "ACTION_TOOL_PEN"})
app.uiAction({["action"] = "ACTION_TOOL_DRAW_COORDINATE_SYSTEM"})
-- currentTool = "pen"
end
function size_fine()
app.uiAction({["action"] = "ACTION_SIZE_FINE"})
end
function size_medium()
app.uiAction({["action"] = "ACTION_SIZE_MEDIUM"})
end
function size_thick()
app.uiAction({["action"] = "ACTION_SIZE_THICK"})
end

View File

@@ -0,0 +1,15 @@
[about]
## Author / Copyright notice
author=Ben Smith
description=Creates some useful key bindings.
## If the plugin is packed with Xournal++, use
## <xournalpp> then it gets the same version number
version=0.1
[default]
enabled=true
[plugin]
mainfile=main.lua

44
xournalapp/toolbar.ini Normal file
View File

@@ -0,0 +1,44 @@
## Xournal++ Toolbar configuration
## Here you can customize the Toolbars
# Delete this file to generate a new config file with default values
#
# Available buttons:
# File: NEW,OPEN,SAVE,SAVEPDF,PRINT
#
# Edit: UNDO,REDO,CUT,COPY,PASTE,SEARCH,DELETE,ROTATION_SNAPPING,GRID_SNAPPING
#
# View: PAIRED_PAGES,PRESENTATION_MODE,FULLSCREEN,MANAGE_TOOLBAR,CUSTOMIZE_TOOLBAR,ZOOM_OUT,ZOOM_IN,ZOOM_FIT,ZOOM_100
#
# Navigation: GOTO_FIRST,GOTO_BACK,GOTO_PAGE,GOTO_NEXT,GOTO_LAST,GOTO_PREVIOUS_LAYER,GOTO_NEXT_LAYER,GOTO_TOP_LAYER,
# GOTO_NEXT_ANNOTATED_PAGE
#
# Journal: INSERT_NEW_PAGE,DELETE_CURRENT_PAGE
#
# Tool: PEN,PLAIN,DASHED,DASH-/ DOTTED,DOTTED,ERASER,HIGHLIGHTER,TEXT,MATH_TEX,IMAGE,DEFAULT_TOOL,SHAPE_RECOGNIZER,SELECT_PDF_TEXT_LINEAR,
# SELECT_PDF_TEXT_RECT,DRAW_RECTANGLE,DRAW_ELLIPSE,DRAW_ARROW,DRAW_DOUBLE_ARROW,DRAW_COORDINATE_SYSTEM,RULER,DRAW_SPLINE,
# SELECT_REGION,SELECT_RECTANGLE,SELECT_MULTILAYER_REGION,SELECT_MULTILAYER_RECTANGLE,SELECT_OBJECT,VERTICAL_SPACE,PLAY_OBJECT,
# HAND,SETSQUARE,COMPASS,SELECT_FONT,AUDIO_RECORDING,AUDIO_PAUSE_PLAYBACK,AUDIO_STOP_PLAYBACK,AUDIO_SEEK_FORWARDS,AUDIO_SEEK_BACKWARDS
# Notice: ERASER and PEN also have drop down menus to select the type, SELECT are all selection tools, with drop down menu
#
# Footer tools: PAGE_SPIN,ZOOM_SLIDER,LAYER,TOOL_FILL,PEN_FILL_OPACITY
# PAGE_SPIN: The page spiner, incl. current page label
# ZOOM_SLIDER: The zoom slider
# LAYER: The layer dropdown menu
#
# Color: COLOR(0),COLOR(1),COLOR(2),COLOR(3),COLOR(4),COLOR(5),COLOR(6),COLOR(7),COLOR(8),COLOR(9),COLOR(10),COLOR_SELECT
# Notice: The colors reference the respective color in the palette.gpl file.
# For backwards compatibility the hex representation, e.g. COLOR(0xff8000), is still permitted. However, the hex value
# will be IGNORED in favour of the "next" palette color. They will be automatically migrated when the user customizes
# the respective toolbar configuration.
#
# Non-menu items: SELECT,DRAW,PDF_TOOL
#
# Tool configuration: VERY_FINE,FINE,MEDIUM,THICK,VERY_THICK
#
# Item separation: SEPARATOR,SPACER
#
#
[Xournal++ Copy]
toolbarTop1=SAVE,NEW,OPEN,SEPARATOR,SAVEPDF,PRINT,SEPARATOR,SEPARATOR,SEPARATOR,PEN,ERASER,HIGHLIGHTER,PLAIN,DASHED,DOTTED,IMAGE,TEXT,MATH_TEX,DRAW,SEPARATOR,SELECT,VERTICAL_SPACE,HAND,SEPARATOR,FINE,MEDIUM,THICK,SEPARATOR,TOOL_FILL,SEPARATOR,COLOR(0),COLOR(1),COLOR(2),COLOR(3),COLOR(4),COLOR(5),COLOR(6),COLOR(7),COLOR(8),COLOR(9),COLOR(10),COLOR_SELECT,SEPARATOR,SELECT_FONT
toolbarBottom1=PAGE_SPIN,SEPARATOR,LAYER,GOTO_FIRST,GOTO_NEXT_ANNOTATED_PAGE,GOTO_LAST,INSERT_NEW_PAGE,DELETE_CURRENT_PAGE,SPACER,PAIRED_PAGES,PRESENTATION_MODE,ZOOM_100,ZOOM_FIT,ZOOM_OUT,ZOOM_SLIDER,ZOOM_IN,SEPARATOR,FULLSCREEN
name=Xournal++ Copy